package com.chixing.day08_interface.homework;

public class order implements Cloneable {
    private  String orderName;
    private  Product product;
    private  int number;
    public order()
    {}

    public order(String orderName, Product product, int number) {
        super();
        this.orderName = orderName;
        this.product = product;
        this.number = number;
    }
    public String getOrderName() {
        return orderName;
    }
    public void setOrderName(String orderName) {
        this.orderName = orderName;
    }
    public Product getProduct() {
        return product;
    }
    public void setProduct(Product product) {
        this.product = product;
    }
    public int getNumber() {
        return number;
    }
    public void setNumber(int number) {
        this.number = number;
    }
    public order clone()
    {
        order order=null;
        try {

            order=(order)super.clone();
            order.product=(Product)this.product.clone();
        } catch (CloneNotSupportedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return order;

    }
    public void show()
    {
        System.out.println("订单数量: "+this.getNumber());
        System.out.println("产品id: "+this.getProduct().getId());
        System.out.println("产品名称: "+this.getProduct().getName());
        System.out.println("用户名称: "+this.getOrderName());
    }
}
